package sample.service;

import javafx.collections.ObservableList;
import javafx.scene.control.SelectionMode;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import sample.entity.DataEntity;
import sample.entity.DataMainSheetEntity;
import sample.util.ParamsUtil;
import sample.util.ReadExcelData;

import java.util.List;
import java.util.Map;

/**
 * Created by lenovo on 2017/1/6.
 */
public class MainService {

    /**
     * 表格初始化
     * @param table_lora 要初始化的表格
     */
    public static void initTable(final TableView table_lora, final String path, final int sheetIndex){

         new Thread(new Runnable(){

             @Override
             public void run() {
                 List<Map<String,Object>> MainData= ReadExcelData.readXml(path,sheetIndex);
                 table_lora.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
                 ObservableList<TableColumn> observableList = table_lora.getColumns();
                 observableList.get(0).setCellValueFactory(new PropertyValueFactory("INDEX"));
                 observableList.get(1).setCellValueFactory(new PropertyValueFactory("XSZZ"));
                 observableList.get(1).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(2).setCellValueFactory(new PropertyValueFactory("BM"));
                 observableList.get(3).setCellValueFactory(new PropertyValueFactory("DDLX"));
                 observableList.get(3).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(4).setCellValueFactory(new PropertyValueFactory("DDZT"));
                 observableList.get(4).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(5).setCellValueFactory(new PropertyValueFactory("DJH"));
                 observableList.get(5).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(6).setCellValueFactory(new PropertyValueFactory("DDRQ"));
                 observableList.get(6).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(7).setCellValueFactory(new PropertyValueFactory("KH"));
                 observableList.get(7).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(8).setCellValueFactory(new PropertyValueFactory("KHLXFS"));
                 observableList.get(8).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(9).setCellValueFactory(new PropertyValueFactory("JJGW"));
                 observableList.get(9).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(10).setCellValueFactory(new PropertyValueFactory("FZGW"));
                 observableList.get(10).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(11).setCellValueFactory(new PropertyValueFactory("BZH"));
                 observableList.get(11).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(12).setCellValueFactory(new PropertyValueFactory("WLBM"));
                 observableList.get(12).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(13).setCellValueFactory(new PropertyValueFactory("WLMC"));
                 observableList.get(13).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(14).setCellValueFactory(new PropertyValueFactory("GG"));
                 observableList.get(14).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(15).setCellValueFactory(new PropertyValueFactory("XH"));
                 observableList.get(15).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(16).setCellValueFactory(new PropertyValueFactory("ZDW"));
                 observableList.get(16).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(17).setCellValueFactory(new PropertyValueFactory("ZSL"));
                 observableList.get(17).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(18).setCellValueFactory(new PropertyValueFactory("ZP"));
                 observableList.get(18).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(19).setCellValueFactory(new PropertyValueFactory("ZHSJJ"));
                 observableList.get(19).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(20).setCellValueFactory(new PropertyValueFactory("JSHJ"));
                 observableList.get(20).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(21).setCellValueFactory(new PropertyValueFactory("JHFHRQ"));
                 observableList.get(21).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(22).setCellValueFactory(new PropertyValueFactory("CKZSL"));
                 observableList.get(22).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(23).setCellValueFactory(new PropertyValueFactory("QSZSL"));
                 observableList.get(23).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(24).setCellValueFactory(new PropertyValueFactory("TSZSL"));
                 observableList.get(24).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(25).setCellValueFactory(new PropertyValueFactory("DCKZSL"));
                 observableList.get(25).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(26).setCellValueFactory(new PropertyValueFactory("KPZSL"));
                 observableList.get(26).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(27).setCellValueFactory(new PropertyValueFactory("ZGYSJE"));
                 observableList.get(27).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(28).setCellValueFactory(new PropertyValueFactory("YSZSL"));
                 observableList.get(28).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(29).setCellValueFactory(new PropertyValueFactory("YSJE"));
                 observableList.get(29).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(30).setCellValueFactory(new PropertyValueFactory("SKJE"));
                 observableList.get(30).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(31).setCellValueFactory(new PropertyValueFactory("YSYE"));
                 observableList.get(31).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(32).setCellValueFactory(new PropertyValueFactory("CBJSZSL"));
                 observableList.get(32).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(33).setCellValueFactory(new PropertyValueFactory("KHSHDZ"));
                 observableList.get(33).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(34).setCellValueFactory(new PropertyValueFactory("LXDH"));
                 observableList.get(34).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(35).setCellValueFactory(new PropertyValueFactory("SHSJ"));
                 observableList.get(35).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(36).setCellValueFactory(new PropertyValueFactory("DGY"));
                 observableList.get(36).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(37).setCellValueFactory(new PropertyValueFactory("ZDXLBZ"));
                 observableList.get(37).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(38).setCellValueFactory(new PropertyValueFactory("ZJ"));
                 observableList.get(38).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(39).setCellValueFactory(new PropertyValueFactory("TJ"));
                 observableList.get(39).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(40).setCellValueFactory(new PropertyValueFactory("RT"));
                 observableList.get(40).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(41).setCellValueFactory(new PropertyValueFactory("GRZJ"));
                 observableList.get(41).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(42).setCellValueFactory(new PropertyValueFactory("GRTJ"));
                 observableList.get(42).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(43).setCellValueFactory(new PropertyValueFactory("GRRT"));
                 observableList.get(43).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(44).setCellValueFactory(new PropertyValueFactory("BZ"));
                 observableList.get(44).setCellFactory(TextFieldTableCell.forTableColumn());
                 observableList.get(45).setCellValueFactory(new PropertyValueFactory("JL"));
                 observableList.get(45).setCellFactory(TextFieldTableCell.forTableColumn());
                 for(int i=1;i<MainData.size();i++){
                     ParamsUtil.data=new DataEntity();
                     ParamsUtil.data.setINDEX(i);
                     ParamsUtil.data.setXSZZ((String)MainData.get(i).get("销售组织"));
                     ParamsUtil.data.setBM((String)MainData.get(i).get("部门"));
                     ParamsUtil.data.setDDLX((String)MainData.get(i).get("订单类型"));
                     ParamsUtil.data.setDDZT((String)MainData.get(i).get("订单状态"));
                     ParamsUtil.data.setDJH((String)MainData.get(i).get("单据号"));
                     ParamsUtil.data.setDDRQ((String)MainData.get(i).get("订单日期"));
                     ParamsUtil.data.setKH((String)MainData.get(i).get("客户"));
                     ParamsUtil.data.setKHLXFS((String)MainData.get(i).get("客户联系方式"));
                     ParamsUtil.data.setJJGW((String)MainData.get(i).get("家居顾问"));
                     ParamsUtil.data.setFZGW((String)MainData.get(i).get("辅助顾问"));
                     ParamsUtil.data.setBZH((String)MainData.get(i).get("币种"));
                     ParamsUtil.data.setWLBM((String)MainData.get(i).get("物料编码"));
                     ParamsUtil.data.setWLMC((String)MainData.get(i).get("物料名称"));
                     ParamsUtil.data.setGG((String)MainData.get(i).get("规格"));
                     ParamsUtil.data.setXH((String)MainData.get(i).get("型号"));
                     ParamsUtil.data.setZDW((String)MainData.get(i).get("主单位"));
                     ParamsUtil.data.setZSL((String)MainData.get(i).get("主数量"));
                     ParamsUtil.data.setZP((String)MainData.get(i).get("赠品"));
                     ParamsUtil.data.setZHSJJ((String)MainData.get(i).get("主含税净价"));
                     ParamsUtil.data.setJSHJ((String)MainData.get(i).get("价税合计"));
                     ParamsUtil.data.setJHFHRQ((String)MainData.get(i).get("计划发货日期"));
                     if(null!=MainData.get(i).get("出库主数量")) {
                         ParamsUtil.data.setCKZSL((String) MainData.get(i).get("出库主数量"));
                     }else{
                         ParamsUtil.data.setCKZSL(" ");
                     }
                     if(null!=MainData.get(i).get("签收主数量")) {
                         ParamsUtil.data.setQSZSL((String) MainData.get(i).get("签收主数量"));
                     }else{
                         ParamsUtil.data.setQSZSL(" ");
                     }
                     if(null!=MainData.get(i).get("途损主数量")) {
                         ParamsUtil.data.setTSZSL((String) MainData.get(i).get("途损主数量"));
                     }else{
                         ParamsUtil.data.setTSZSL(" ");
                     }
                     if(null!=MainData.get(i).get("待出库主数量")) {
                         ParamsUtil.data.setDCKZSL((String) MainData.get(i).get("待出库主数量"));
                     }else{
                         ParamsUtil.data.setDCKZSL(" ");
                     }
                     if(null!=MainData.get(i).get("开票主数量")) {
                         ParamsUtil.data.setKPZSL((String) MainData.get(i).get("开票主数量"));
                     }else{
                         ParamsUtil.data.setKPZSL(" ");
                     }
                     if(null!=MainData.get(i).get("暂估应收金额")) {
                         ParamsUtil.data.setZGYSJE((String) MainData.get(i).get("暂估应收金额"));
                     }else{
                         ParamsUtil.data.setZGYSJE(" ");
                     }
                     if(null!=MainData.get(i).get("应收主数量")) {
                         ParamsUtil.data.setYSZSL((String) MainData.get(i).get("应收主数量"));
                     }else{
                         ParamsUtil.data.setYSZSL(" ");
                     }
                     if(null!=MainData.get(i).get("应收金额")) {
                         ParamsUtil.data.setYSJE((String) MainData.get(i).get("应收金额"));
                     }else{
                         ParamsUtil.data.setYSJE(" ");
                     }
                     if(null!=MainData.get(i).get("收款金额")) {
                         ParamsUtil.data.setSKJE((String)MainData.get(i).get("收款金额"));
                     }else{
                         ParamsUtil.data.setSKJE(" ");
                     }
                     if(null!=MainData.get(i).get("应收余额")) {
                         ParamsUtil.data.setYSYE((String) MainData.get(i).get("应收余额"));
                     }else{
                         ParamsUtil.data.setYSYE(" ");
                     }
                     if(null!=MainData.get(i).get("成本结算主数量")) {
                         ParamsUtil.data.setCBJSZSL((String)MainData.get(i).get("成本结算主数量"));
                     }else{
                         ParamsUtil.data.setCBJSZSL(" ");
                     }
                     ParamsUtil.data.setKHSHDZ((String)MainData.get(i).get("客户送货地址"));
                     ParamsUtil.data.setLXDH((String)MainData.get(i).get("联系电话"));
                     ParamsUtil.data.setSHSJ((String)MainData.get(i).get("送货时间"));
                     ParamsUtil.data.setDGY((String)MainData.get(i).get("导购员"));
                     ParamsUtil.data.setZDXLBZ((String)MainData.get(i).get("整单销量备注"));
                     if(null!=MainData.get(i).get("正价")) {
                         ParamsUtil.data.setZJ((String)MainData.get(i).get("正价"));
                     }else{
                         ParamsUtil.data.setZJ(" ");
                     }
                     if(null!=MainData.get(i).get("特价")) {
                         ParamsUtil.data.setTJ((String) MainData.get(i).get("特价"));
                     }else{
                         ParamsUtil.data.setTJ(" ");
                     }
                     if(null!=MainData.get(i).get("软体")) {
                         ParamsUtil.data.setRT((String) MainData.get(i).get("软体"));
                     }else{
                         ParamsUtil.data.setRT(" ");
                     }
                     if(null!=MainData.get(i).get("个人正价")) {
                         ParamsUtil.data.setGRZJ((String) MainData.get(i).get("个人正价"));
                     }else{
                         ParamsUtil.data.setGRZJ(" ");
                     }
                     if(null!=MainData.get(i).get("个人特价")) {
                         ParamsUtil.data.setGRTJ((String) MainData.get(i).get("个人特价"));
                     }else{
                         ParamsUtil.data.setGRTJ(" ");
                     }
                     if(null!=MainData.get(i).get("个人软体")) {
                         ParamsUtil.data.setGRRT((String) MainData.get(i).get("个人软体"));
                     }else{
                         ParamsUtil.data.setGRRT(" ");
                     }
                     ParamsUtil.data.setBZ((String)MainData.get(i).get("备注"));
                     if(null!=MainData.get(i).get("计量")) {
                         ParamsUtil.data.setJL((String) MainData.get(i).get("计量"));
                     }else{
                         ParamsUtil.data.setJL(" ");
                     }
                    try {
                        ParamsUtil.data_db.add(ParamsUtil.data);
                    }catch(NullPointerException e){}
                 }
                 table_lora.setItems(ParamsUtil.data_db);
             }
         }).start();
    }
    public static void initMainTable(final TableView table_lora, final String path, final int sheetIndex){
        new Thread(new Runnable(){

            @Override
            public void run() {
                List<Map<String,Object>> MainData= ReadExcelData.readXml(path,sheetIndex);
                table_lora.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
                ObservableList<TableColumn> observableList = table_lora.getColumns();
                observableList.get(0).setCellValueFactory(new PropertyValueFactory("INDEX"));
                observableList.get(1).setCellValueFactory(new PropertyValueFactory("XSZZ"));
                observableList.get(1).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(2).setCellValueFactory(new PropertyValueFactory("BM"));
                observableList.get(3).setCellValueFactory(new PropertyValueFactory("DDLX"));
                observableList.get(3).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(4).setCellValueFactory(new PropertyValueFactory("DDZT"));
                observableList.get(4).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(5).setCellValueFactory(new PropertyValueFactory("DJH"));
                observableList.get(5).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(6).setCellValueFactory(new PropertyValueFactory("DDRQ"));
                observableList.get(6).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(7).setCellValueFactory(new PropertyValueFactory("KH"));
                observableList.get(7).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(8).setCellValueFactory(new PropertyValueFactory("KHLXFS"));
                observableList.get(8).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(9).setCellValueFactory(new PropertyValueFactory("JJGW"));
                observableList.get(9).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(10).setCellValueFactory(new PropertyValueFactory("FZGW"));
                observableList.get(10).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(11).setCellValueFactory(new PropertyValueFactory("BZH"));
                observableList.get(11).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(12).setCellValueFactory(new PropertyValueFactory("WLBM"));
                observableList.get(12).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(13).setCellValueFactory(new PropertyValueFactory("WLMC"));
                observableList.get(13).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(14).setCellValueFactory(new PropertyValueFactory("GG"));
                observableList.get(14).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(15).setCellValueFactory(new PropertyValueFactory("XH"));
                observableList.get(15).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(16).setCellValueFactory(new PropertyValueFactory("ZDW"));
                observableList.get(16).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(17).setCellValueFactory(new PropertyValueFactory("ZSL"));
                observableList.get(17).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(18).setCellValueFactory(new PropertyValueFactory("ZP"));
                observableList.get(18).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(19).setCellValueFactory(new PropertyValueFactory("ZHSJJ"));
                observableList.get(19).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(20).setCellValueFactory(new PropertyValueFactory("JSHJ"));
                observableList.get(20).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(21).setCellValueFactory(new PropertyValueFactory("JHFHRQ"));
                observableList.get(21).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(22).setCellValueFactory(new PropertyValueFactory("CKZSL"));
                observableList.get(22).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(23).setCellValueFactory(new PropertyValueFactory("QSZSL"));
                observableList.get(23).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(24).setCellValueFactory(new PropertyValueFactory("TSZSL"));
                observableList.get(24).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(25).setCellValueFactory(new PropertyValueFactory("DCKZSL"));
                observableList.get(25).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(26).setCellValueFactory(new PropertyValueFactory("KPZSL"));
                observableList.get(26).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(27).setCellValueFactory(new PropertyValueFactory("ZGYSJE"));
                observableList.get(27).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(28).setCellValueFactory(new PropertyValueFactory("YSZSL"));
                observableList.get(28).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(29).setCellValueFactory(new PropertyValueFactory("YSJE"));
                observableList.get(29).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(30).setCellValueFactory(new PropertyValueFactory("SKJE"));
                observableList.get(30).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(31).setCellValueFactory(new PropertyValueFactory("YSYE"));
                observableList.get(31).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(32).setCellValueFactory(new PropertyValueFactory("CBJSZSL"));
                observableList.get(32).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(33).setCellValueFactory(new PropertyValueFactory("KHSHDZ"));
                observableList.get(33).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(34).setCellValueFactory(new PropertyValueFactory("LXDH"));
                observableList.get(34).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(35).setCellValueFactory(new PropertyValueFactory("SHSJ"));
                observableList.get(35).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(36).setCellValueFactory(new PropertyValueFactory("DGY"));
                observableList.get(36).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(37).setCellValueFactory(new PropertyValueFactory("ZDXLBZ"));
                observableList.get(37).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(38).setCellValueFactory(new PropertyValueFactory("ZJ"));
                observableList.get(38).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(39).setCellValueFactory(new PropertyValueFactory("TJ"));
                observableList.get(39).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(40).setCellValueFactory(new PropertyValueFactory("RT"));
                observableList.get(40).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(41).setCellValueFactory(new PropertyValueFactory("GRZJ"));
                observableList.get(41).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(42).setCellValueFactory(new PropertyValueFactory("GRTJ"));
                observableList.get(42).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(43).setCellValueFactory(new PropertyValueFactory("GRRT"));
                observableList.get(43).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(44).setCellValueFactory(new PropertyValueFactory("BZ"));
                observableList.get(44).setCellFactory(TextFieldTableCell.forTableColumn());
                observableList.get(45).setCellValueFactory(new PropertyValueFactory("JL"));
                observableList.get(45).setCellFactory(TextFieldTableCell.forTableColumn());
                for(int i=1;i<MainData.size();i++){
                    ParamsUtil.dataMainSheet=new DataMainSheetEntity();
                    ParamsUtil.dataMainSheet.setINDEX(i);
                    ParamsUtil.dataMainSheet.setXSZZ((String)MainData.get(i).get("销售组织"));
                    ParamsUtil.dataMainSheet.setBM((String)MainData.get(i).get("部门"));
                    ParamsUtil.dataMainSheet.setDDLX((String)MainData.get(i).get("订单类型"));
                    ParamsUtil.dataMainSheet.setDDZT((String)MainData.get(i).get("订单状态"));
                    ParamsUtil.dataMainSheet.setDJH((String)MainData.get(i).get("单据号"));
                    ParamsUtil.dataMainSheet.setDDRQ((String)MainData.get(i).get("订单日期"));
                    ParamsUtil.dataMainSheet.setKH((String)MainData.get(i).get("客户"));
                    ParamsUtil.dataMainSheet.setKHLXFS((String)MainData.get(i).get("客户联系方式"));
                    ParamsUtil.dataMainSheet.setJJGW((String)MainData.get(i).get("家居顾问"));
                    ParamsUtil.dataMainSheet.setFZGW((String)MainData.get(i).get("辅助顾问"));
                    ParamsUtil.dataMainSheet.setBZH((String)MainData.get(i).get("币种"));
                    ParamsUtil.dataMainSheet.setWLBM((String)MainData.get(i).get("物料编码"));
                    ParamsUtil.dataMainSheet.setWLMC((String)MainData.get(i).get("物料名称"));
                    ParamsUtil.dataMainSheet.setGG((String)MainData.get(i).get("规格"));
                    ParamsUtil.dataMainSheet.setXH((String)MainData.get(i).get("型号"));
                    ParamsUtil.dataMainSheet.setZDW((String)MainData.get(i).get("主单位"));
                    ParamsUtil.dataMainSheet.setZSL((String)MainData.get(i).get("主数量"));
                    ParamsUtil.dataMainSheet.setZP((String)MainData.get(i).get("赠品"));
                    ParamsUtil.dataMainSheet.setZHSJJ((String)MainData.get(i).get("主含税净价"));
                    ParamsUtil.dataMainSheet.setJSHJ((String)MainData.get(i).get("价税合计"));
                    ParamsUtil.dataMainSheet.setJHFHRQ((String)MainData.get(i).get("计划发货日期"));
                    if(null!=MainData.get(i).get("出库主数量")) {
                        ParamsUtil.dataMainSheet.setCKZSL((String) MainData.get(i).get("出库主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setCKZSL(" ");
                    }
                    if(null!=MainData.get(i).get("签收主数量")) {
                        ParamsUtil.dataMainSheet.setQSZSL((String) MainData.get(i).get("签收主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setQSZSL(" ");
                    }
                    if(null!=MainData.get(i).get("途损主数量")) {
                        ParamsUtil.dataMainSheet.setTSZSL((String) MainData.get(i).get("途损主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setTSZSL(" ");
                    }
                    if(null!=MainData.get(i).get("待出库主数量")) {
                        ParamsUtil.dataMainSheet.setDCKZSL((String) MainData.get(i).get("待出库主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setDCKZSL(" ");
                    }
                    if(null!=MainData.get(i).get("开票主数量")) {
                        ParamsUtil.dataMainSheet.setKPZSL((String) MainData.get(i).get("开票主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setKPZSL(" ");
                    }
                    if(null!=MainData.get(i).get("暂估应收金额")) {
                        ParamsUtil.dataMainSheet.setZGYSJE((String) MainData.get(i).get("暂估应收金额"));
                    }else{
                        ParamsUtil.dataMainSheet.setZGYSJE(" ");
                    }
                    if(null!=MainData.get(i).get("应收主数量")) {
                        ParamsUtil.dataMainSheet.setYSZSL((String) MainData.get(i).get("应收主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setYSZSL(" ");
                    }
                    if(null!=MainData.get(i).get("应收金额")) {
                        ParamsUtil.dataMainSheet.setYSJE((String) MainData.get(i).get("应收金额"));
                    }else{
                        ParamsUtil.dataMainSheet.setYSJE(" ");
                    }
                    if(null!=MainData.get(i).get("收款金额")) {
                        ParamsUtil.dataMainSheet.setSKJE((String)MainData.get(i).get("收款金额"));
                    }else{
                        ParamsUtil.dataMainSheet.setSKJE(" ");
                    }
                    if(null!=MainData.get(i).get("应收余额")) {
                        ParamsUtil.dataMainSheet.setYSYE((String) MainData.get(i).get("应收余额"));
                    }else{
                        ParamsUtil.dataMainSheet.setYSYE(" ");
                    }
                    if(null!=MainData.get(i).get("成本结算主数量")) {
                        ParamsUtil.dataMainSheet.setCBJSZSL((String)MainData.get(i).get("成本结算主数量"));
                    }else{
                        ParamsUtil.dataMainSheet.setCBJSZSL(" ");
                    }
                    ParamsUtil.dataMainSheet.setKHSHDZ((String)MainData.get(i).get("客户送货地址"));
                    ParamsUtil.dataMainSheet.setLXDH((String)MainData.get(i).get("联系电话"));
                    ParamsUtil.dataMainSheet.setSHSJ((String)MainData.get(i).get("送货时间"));
                    ParamsUtil.dataMainSheet.setDGY((String)MainData.get(i).get("导购员"));
                    ParamsUtil.dataMainSheet.setZDXLBZ((String)MainData.get(i).get("整单销量备注"));
                    if(null!=MainData.get(i).get("正价")) {
                        ParamsUtil.dataMainSheet.setZJ((String)MainData.get(i).get("正价"));
                    }else{
                        ParamsUtil.dataMainSheet.setZJ(" ");
                    }
                    if(null!=MainData.get(i).get("特价")) {
                        ParamsUtil.dataMainSheet.setTJ((String) MainData.get(i).get("特价"));
                    }else{
                        ParamsUtil.dataMainSheet.setTJ(" ");
                    }
                    if(null!=MainData.get(i).get("软体")) {
                        ParamsUtil.dataMainSheet.setRT((String) MainData.get(i).get("软体"));
                    }else{
                        ParamsUtil.dataMainSheet.setRT(" ");
                    }
                    if(null!=MainData.get(i).get("个人正价")) {
                        ParamsUtil.dataMainSheet.setGRZJ((String) MainData.get(i).get("个人正价"));
                    }else{
                        ParamsUtil.dataMainSheet.setGRZJ(" ");
                    }
                    if(null!=MainData.get(i).get("个人特价")) {
                        ParamsUtil.dataMainSheet.setGRTJ((String) MainData.get(i).get("个人特价"));
                    }else{
                        ParamsUtil.dataMainSheet.setGRTJ(" ");
                    }
                    if(null!=MainData.get(i).get("个人软体")) {
                        ParamsUtil.dataMainSheet.setGRRT((String) MainData.get(i).get("个人软体"));
                    }else{
                        ParamsUtil.dataMainSheet.setGRRT(" ");
                    }
                    ParamsUtil.dataMainSheet.setBZ((String)MainData.get(i).get("备注"));
                    if(null!=MainData.get(i).get("计量")) {
                        ParamsUtil.dataMainSheet.setJL((String) MainData.get(i).get("计量"));
                    }else{
                        ParamsUtil.dataMainSheet.setJL(" ");
                    }
                    try {
                        ParamsUtil.data_mainSheet.add(ParamsUtil.dataMainSheet);
                    }catch(NullPointerException e){}
                }
                table_lora.setItems(ParamsUtil.data_mainSheet);
            }
        }).start();
    }
}
